package org.springframework.android.showcase.rest;

import org.springframework.android.showcase.AbstractMenuActivity;
import org.springframework.android.showcase.R;

import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

public class JsonXmlActivity extends AbstractMenuActivity {

	// ***************************************
	// AbstractMenuActivity methods
	// ***************************************
	@Override
	protected String getDescription() {
		return getResources().getString(R.string.text_http_get_json_xml_description);
	}

	@Override
	protected String[] getMenuItems() {
		return getResources().getStringArray(R.array.http_get_json_xml_activity_menu_items);
	}

	@Override
	protected OnItemClickListener getMenuOnItemClickListener() {
		return new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parentView, View childView, int position, long id) {
				switch (position) {
				case 0:
					startActivity(new Intent(parentView.getContext(), HttpGetJsonActivity.class));
					break;
				case 1:
					startActivity(new Intent(parentView.getContext(), HttpGetXmlActivity.class));
					break;
				default:
					break;
				}
			}
		};
	}

}
